/// <reference path="../types.ts" />
/// <reference path="../helpers.ts" />
/// <reference path="organization.ts" />

module $Xrm.Messages {
    export class SendEmailRequest extends OrganizationRequest {
        public EmailId: string = null;
        public IssueSend: bool = null;
        public TrackingToken: string = "";

        constructor() {
            super("SendEmail", "b");
        }

        GetResponse(responseXml: Document): SendEmailResponse {
            return new SendEmailResponse(responseXml);
        }

        ToSoapXml(): string {
            this.Parameters["EmailId"] = this.EmailId;
            this.Parameters["IssueSend"] = this.IssueSend;
            this.Parameters["TrackingToken"] = this.TrackingToken;

            return super.ToSoapXml();
        }
    }

    export class SendEmailResponse extends OrganizationResponse {
        public Subject: string;

        constructor(responseXml?: Document) {
            super("SendEmail", responseXml);

            this.BindProperties();
        }

        BindProperties(): void {
            super.BindProperties();

            this.Subject = this.Results["Subject"];
        }
    }
}